﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
    string connectionString = "server=.\\sqlexpress;database=AdventureWorks;integrated security=true";
    string query = "select CountryRegionCode, Name, ModifiedDate from Person.CountryRegion";       

    using( SqlConnection connection = new SqlConnection( connectionString))
    {
        SqlCommand command = new SqlCommand( query, connection);
        connection.Open();
        SqlDataReader reader = command.ExecuteReader();

        this.GridView1.DataSource = reader;
        this.GridView1.DataBind();

        reader.Close();
    }
}
}